import { useContext } from 'react'

import { GlobalContext } from '../context'
import defaultLocale from '../locale'

function useLocale(locale: any) {
  const { lang } = useContext(GlobalContext)

  return (locale || defaultLocale)[lang as 'en-US' | 'ar-EG']
}

export default useLocale
